package com.manage.common.util.dataFunction;

import java.text.DecimalFormat;
import java.util.Random;

/**
 * 随机生成手机号
 * @author duaiyu
 * @version V1.0
 * @date 2022/2/27
 * 来源：自研
 */
public class CreatePhone {
    //生成手机号
    public static String getPhone(){
        return start() + end();
    }

    //生成前三位
    public static String start(){
        String[] star = {"134", "135", "136", "137", "138", "139", "150", "151", "152",
                "158", "159", "157", "182", "187", "188", "147", "130", "131", "132", "155", "156",
                "185", "186", "133", "153", "180", "189"};
        Integer num = new Random().nextInt(27);
        return star[num];
    }

    //生成剩下的手机号 8位
    public static String end(){
        double random = Math.random();
        DecimalFormat df = new DecimalFormat("0.00000000");
        String format = df.format(random).substring(2);
        return format;
    }
}
